package com.szsh.aiot.hsm.enums;

/**
 * 服务商标识
 * 
 * @author zhangtt
 *
 */
public enum IdentityType {

    QIANXIN(1, "QI-ANXIN001", "奇安信"), MAIKE(2, "MK001", "迈科");

    private final int type;
    private final String platformID;
    private final String description;

    private IdentityType(int type, String platformID, String description) {
        this.type = type;
        this.platformID = platformID;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getPlatformID() {
        return platformID;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据identity类型返回能力平台ID
     * 
     * @param type
     * @return
     */
    public static String getPlatfromID(int type) {
        for(IdentityType identity:IdentityType.values()){
            if(identity.type == type){
                return identity.getPlatformID();
            }
        }
        return "";
    }

    /**
     * 根据identity类型返回identity
     * 
     * @param type
     * @return
     */
    public static IdentityType getIdentity(int type) {
        for (IdentityType identity : IdentityType.values()) {
            if (identity.type == type) {
                return identity;
            }
        }
        return IdentityType.QIANXIN;
    }
}
